import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

public class Database {
	
	
	public Database(String search) throws Exception {
		try{ 
			 Class.forName("com.mysql.jdbc.Driver");
			 

			Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/project" ,"root","");
			PreparedStatement statement = con.prepareStatement("SELECT * FROM restaurant WHERE Name  LIKE '%"+ search +"%'  ");
			ResultSet result = statement.executeQuery();
			
			
		while(result.next()){
			    System.out.println("You searched for " + search + " These are the results: ");
				System.out.println(result.getString("restID")+ " " + result.getString("Name"));
				//System.out.println(result.getString("Name"));

			}
		
		} catch (Exception e) {
			e.printStackTrace();
		}

	}
	}
